package com.ruoyi.web.controller.net;

import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.net.domain.BusiL2VpnNodeInfo;
import com.ruoyi.net.domain.BusiL2VpnNodeInfoListVo;
import com.ruoyi.net.service.IBusiL2VpnNodeInfoService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * 业务-L2 VPN配置-节点属性-节点信息Controller
 * 
 * @author tony
 * @date 2024-12-14
 */
@Api(tags = "业务-L2 VPN配置-节点属性-节点信息")
@RestController
@RequestMapping("/busi/l2/vpn/node/info")
public class BusiL2VpnNodeInfoController extends BaseController
{
    @Autowired
    private IBusiL2VpnNodeInfoService busiL2VpnNodeInfoService;

    /**
     * 查询业务-L2 VPN配置-节点属性-节点信息列表
     */
    @ApiOperation(value = "查询业务-L2 VPN配置-节点属性-节点信息列表", httpMethod = "GET")
    @PreAuthorize("@ss.hasPermi('net:info:list')")
    @GetMapping("/list")
    public TableDataInfo list(BusiL2VpnNodeInfo busiL2VpnNodeInfo)
    {
        startPage();
        List<BusiL2VpnNodeInfoListVo> list = busiL2VpnNodeInfoService.selectBusiL2VpnNodeInfoList(busiL2VpnNodeInfo);
        return getDataTable(list);
    }

    /**
     * 导出业务-L2 VPN配置-节点属性-节点信息列表
     */
    @ApiOperation(value = "导出业务-L2 VPN配置-节点属性-节点信息列表", httpMethod = "POST")
    @PreAuthorize("@ss.hasPermi('net:info:export')")
    @Log(title = "业务-L2 VPN配置-节点属性-节点信息", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, BusiL2VpnNodeInfo busiL2VpnNodeInfo)
    {
        List<BusiL2VpnNodeInfoListVo> list = busiL2VpnNodeInfoService.selectBusiL2VpnNodeInfoList(busiL2VpnNodeInfo);
        ExcelUtil<BusiL2VpnNodeInfoListVo> util = new ExcelUtil<BusiL2VpnNodeInfoListVo>(BusiL2VpnNodeInfoListVo.class);
        util.exportExcel(response, list, "业务-L2 VPN配置-节点属性-节点信息数据");
    }

    /**
     * 获取业务-L2 VPN配置-节点属性-节点信息详细信息
     */
    @ApiOperation(value = "获取业务-L2 VPN配置-节点属性-节点信息详细信息", httpMethod = "GET")
    @PreAuthorize("@ss.hasPermi('net:info:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") String id)
    {
        return success(busiL2VpnNodeInfoService.selectBusiL2VpnNodeInfoById(id));
    }

    /**
     * 新增业务-L2 VPN配置-节点属性-节点信息
     */
    @ApiOperation(value = "新增业务-L2 VPN配置-节点属性-节点信息", httpMethod = "POST")
    @PreAuthorize("@ss.hasPermi('net:info:add')")
    @Log(title = "业务-L2 VPN配置-节点属性-节点信息", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody BusiL2VpnNodeInfo busiL2VpnNodeInfo)
    {
        return toAjax(busiL2VpnNodeInfoService.insertBusiL2VpnNodeInfo(busiL2VpnNodeInfo));
    }

    /**
     * 修改业务-L2 VPN配置-节点属性-节点信息
     */
    @ApiOperation(value = "修改业务-L2 VPN配置-节点属性-节点信息", httpMethod = "PUT")
    @PreAuthorize("@ss.hasPermi('net:info:edit')")
    @Log(title = "业务-L2 VPN配置-节点属性-节点信息", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody BusiL2VpnNodeInfo busiL2VpnNodeInfo)
    {
        return toAjax(busiL2VpnNodeInfoService.updateBusiL2VpnNodeInfo(busiL2VpnNodeInfo));
    }

    /**
     * 删除业务-L2 VPN配置-节点属性-节点信息
     */
    @ApiOperation(value = "删除业务-L2 VPN配置-节点属性-节点信息", httpMethod = "DELETE")
    @PreAuthorize("@ss.hasPermi('net:info:remove')")
    @Log(title = "业务-L2 VPN配置-节点属性-节点信息", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable String[] ids)
    {
        return toAjax(busiL2VpnNodeInfoService.deleteBusiL2VpnNodeInfoByIds(ids));
    }
}
